// 生成代码记录
export interface CodegenRecord {
  id?: string;
  dataSourceConfigId?: string;
  tableName?: string;
  tableComment?: string;
  className?: string;
  createTime?: string;
  updateTime?: string;
}

// 分页查询的参数
export interface CodegenParams extends Partial<CodegenRecord> {
  pageNo: number;
  pageSize: number;
  // Partial携带具体查询条件
}

// 列表值
export interface CodegenListRes {
  list: CodegenRecord[];
  total: number;
}

// 数据库表项，用于导入创建代码生成配置
export interface DbTableRecord {
  comment?: string;
  name?: string;
}

// 代码预览：文件路径和代码
export interface CodePreviewRecord {
  filePath: string;
  code: string;
}

// 具体配置项，用于更新代码生成器配置
export interface ConfigFormModel {
  tableName?: string;
  tableComment?: string;
  className?: string;
  author?: string;
  remark?: string;
  templateType?: number; // 生成模板
  frontType?: number; // 前端类型
  scene?: number; // 生成场景
  parentMenuId?: string; // 上级菜单
  // 以上暂时不需要
  moduleName?: string; // 模块名
  businessName?: string; // 业务名
  classComment?: string; // 类描述
}

// 具体配置项，用于更新代码生成器配置
export interface CodegenConfigRecord {
  table: ConfigFormModel;
  columns: any[];
}

// 用于查询数据库表
export interface DbTableReq {
  dataSourceConfigId?: string;
  comment?: string;
  name?: string;
}

// 用于创建代码生成器
export interface CodegenRecordReq {
  dataSourceConfigId: string | number;
  tableNames: string[];
}

// 数据库建表
// 建表记录
export interface TableRecordReq {
  tableName: string;
  tableComment: string;
  dataSourceConfigId: string;
  columnList?: TableFieldRecord[];
  indexList?: TableIndexRecord[];
}

// 表字段定义
export interface TableFieldRecord {
  id?: string;
  columnName: string;
  dataType: string;
  columnLength?: number;
  decimalPoint?: number;
  defaultValue?: string;
  columnComment: string;
  nullable: boolean;
  primaryKey: boolean;
  autoIncrement: boolean;
}

// 表索引定义
export interface TableIndexRecord {
  id?: string;
  indexName: string;
  indexColumns: string;
  indexComment?: string;
  unique?: boolean;
}
